package com.mallcloud.mall.common.core.constant.enums.mall;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 星光里
 */
@Getter
@AllArgsConstructor
public enum XGLEnum {

	//字典
	REDEEM_STATUS("", ""),
	;

	private final String type;
	private final String description;

	@Getter
	@AllArgsConstructor
	public enum PurposeEnum {
		PAY(1, "买券"),
		FREE(2, "领券"),
		REDEEM(3, "积分兑换券"),
		;
		private Integer code;
		private String description;

		public static String getDecs(Integer type) {
			return Arrays.stream(values()).filter(x -> x.getCode().equals(type)).findFirst().get().getDescription();
		}
	}

	@Getter
	@AllArgsConstructor
	public enum RedeemTypeEnum {
		TYPE_1(1, "免费兑换"),
		TYPE_2(2, "积分兑换"),
		TYPE_3(3, "优惠券兑换"),
		;
		private Integer code;
		private String description;

		public static String getDecs(Integer type) {
			return Arrays.stream(values()).filter(x -> x.getCode().equals(type)).findFirst().get().getDescription();
		}
	}

	@Getter
	@AllArgsConstructor
	public enum RedeemStatusEnum {
		TYPE_1("Y", "已兑换"),
		TYPE_2("N", "未兑换"),
		;
		private String code;
		private String description;

		public static String getDecs(String type) {
			return Arrays.stream(values()).filter(x -> x.getCode().equals(type)).findFirst().get().getDescription();
		}
	}

	@Getter
	@AllArgsConstructor
	public enum RedeemSettingStatusEnum {
		TYPE_1("Y", "可用"),
		TYPE_2("N", "停用"),
		;
		private String code;
		private String description;

		public static String getDecs(String type) {
			return Arrays.stream(values()).filter(x -> x.getCode().equals(type)).findFirst().get().getDescription();
		}
	}
}
